home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Graphics Programming (2nd Edition) / Visual Basic Graphics Programming 2nd Edition.iso / OldSrc / CH9 / SRC / DTWIST.CLS < prev    next >
Encoding:
Text File  |  1995-11-15  |  684 b   |  28 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "DistortTwist"
  6. Attribute VB_Creatable = False
  7. Attribute VB_Exposed = False
  8. Option Explicit
  9.  
  10. ' The center about which to twist.
  11. Public cx As Single
  12. Public cz As Single
  13. Public period As Single
  14. Public offset As Single
  15.  
  16. ' ************************************************
  17. ' Apply a shape distorting transformation to
  18. ' the point.
  19. ' ************************************************
  20. Sub Distort(x As Single, y As Single, z As Single)
  21. Dim theta As Single
  22.     
  23.     theta = (offset - y) * 3.14 / period
  24.     
  25.     x = x * Cos(theta) - z * Sin(theta)
  26.     z = x * Sin(theta) + z * Cos(theta)
  27. End Sub
  28.